//
//  ShowViewDetailViewController.m
//  Crocodile
//
//  Created by CONG TRAN on 9/15/12.
//  Copyright (c) 2012 hust. All rights reserved.
//

#import "ShowViewDetailViewController.h"
#import "Constant.h"
#import "ShowsViewController.h"
#import "MapViewController.h"

@interface ShowViewDetailViewController ()

@end

@implementation ShowViewDetailViewController
@synthesize annonation;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:kImgBackground]];
    self.parentViewController.view.alpha = 1.00;
    
    // Header Image
    
    UIView *backgroundView =[[UIView alloc]initWithFrame:CGRectMake(0, 20, 320, 480)];
    backgroundView.backgroundColor = [UIColor whiteColor];
    backgroundView.alpha = 0.3;
    [self.view addSubview:backgroundView];
    
    
    UIImage *headerImg = [UIImage imageNamed:kImgHeader];
    UIImageView *headerImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
    [headerImgView setImage:headerImg];
    [self.view addSubview:headerImgView];
    [headerImg release];
    [headerImgView release];
    
    // Title
    UILabel *titleLbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 3, 170, 34)];
    titleLbl.backgroundColor = [UIColor clearColor];
    titleLbl.center = CGPointMake(160, 20);
    titleLbl.textAlignment = UITextAlignmentCenter;
    titleLbl.textColor = [UIColor greenColor];
    titleLbl.font = [UIFont boldSystemFontOfSize:20];
    titleLbl.text = kStrShowTabTitle;
    [self.view addSubview:titleLbl];
    [titleLbl release];
    
    UIButton *backButton = [[UIButton alloc]initWithFrame:CGRectMake(10, 10, 60, 30)];
    [backButton setTitle:@"Back" forState:UIControlStateNormal];
    backButton.backgroundColor = [UIColor redColor];
    [backButton addTarget:self action:@selector(goBackToShows) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
    [backButton release];
    
    UIButton *facebookButton = [[UIButton alloc]initWithFrame:CGRectMake(250, 10, 30, 30)];
    [facebookButton setImage:[UIImage imageNamed:@"MRLikeIcon.png"] forState:UIControlStateNormal];
    facebookButton.backgroundColor = [UIColor clearColor];
    [self.view addSubview:facebookButton];
    [facebookButton release];
    
    UILabel *facebookLikeLable = [[UILabel alloc]initWithFrame:CGRectMake(280, 10, 30, 30)];
    facebookLikeLable.backgroundColor = [UIColor clearColor];
    facebookLikeLable.text = @"Like";
    facebookLikeLable.textColor = [UIColor whiteColor];
    facebookLikeLable.font = [UIFont boldSystemFontOfSize:12];
    [self.view addSubview:facebookLikeLable];
    [facebookLikeLable release];
    
    

    
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 60, 80, 100)];
    [imageView setImage:[UIImage imageNamed:@"background2.jpeg"]];
    imageView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:imageView];
    
    UILabel *titleLable = [[UILabel alloc]initWithFrame:CGRectMake(120, 60, 200, 40)];
    titleLable.backgroundColor = [UIColor clearColor];
    titleLable.text = annonation.titleAnnonation;
    titleLable.font = [UIFont boldSystemFontOfSize:18];
    titleLable.textColor = [UIColor whiteColor];
    [self.view addSubview:titleLable];
    
    UILabel *dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(120, 90, 200, 40)];
    dateLabel.backgroundColor = [UIColor clearColor];
    dateLabel.text = annonation.date;
    dateLabel.font = [UIFont boldSystemFontOfSize:14];
    dateLabel.textColor = [UIColor whiteColor];
    [self.view addSubview:dateLabel];
    
    UILabel *contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 150, 280, 80)];
    contentLabel.numberOfLines = 0;
    contentLabel.backgroundColor = [UIColor clearColor];
    contentLabel.text = annonation.conttent;
    contentLabel.textColor = [UIColor whiteColor];
    contentLabel.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:contentLabel];
    
    
    UIButton *viewMapButton = [[UIButton alloc]initWithFrame:CGRectMake(60, 290, 180, 40)];
    [viewMapButton setTitle:@"View on maps" forState:UIControlStateNormal];
    viewMapButton.backgroundColor = [UIColor redColor];
    [viewMapButton addTarget:self action:@selector(viewOnMaps) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:viewMapButton];
    
    
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(void)goBackToShows
{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)viewOnMaps
{
    MapViewController *mapsView = [[MapViewController alloc]init];
    mapsView.annonation = self.annonation;
    [self.navigationController pushViewController:mapsView animated:YES];
}

@end
